package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 支付备注类型（1-订单支付，2-充值会员，3-购买次卡，4-充值补贴金）
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum PayAttachEnum {

    ORDER_PAY(1, "orderPay"),
    MEMBER_FEE_PAY(2, "memberFeePay"),
    MEMBER_CARD_PAY(3, "memberCardPay"),
    RECHARGE_SUBSIDY_PAY(4, "rechargeSubsidyPay"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    PayAttachEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static PayAttachEnum typeOf(Integer value) {
        PayAttachEnum[] values = PayAttachEnum.values();
        for (PayAttachEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static PayAttachEnum typeOf(String name) {
        PayAttachEnum[] values = PayAttachEnum.values();
        for (PayAttachEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
